

$(document).ready(function () {
    var un = $.getUrlParam("username");
    var id = $.getUrlParam("id");

    $("#yes").click(function (e) { 
        confirm(un,id);        
    });
    $("#no").click(function (e) { 
        goback(un);        
    });

    
});

function confirm(un,id){
    console.log(un);
    console.log(id);
    $.ajax({
        type: "POST",
        url: SERVER_PATH + "/cart/deleteproduct",
        data: {
            "username":un,
            "proId":id
        },
        xhrFields: {withCredentials: true},
        success: function (result) {
            if (result.status) {
                alertBox(result.data.message);
                return false;
            }
            alertBox("删除成功！", function() {
                window.location.href = "cart.html?username="+un;
            });
        }
    });

}

function goback(un){

     window.location.href = "cart.html?username="+un;

}